/*
 * signalR.h
 *
 *  Created on: 2012-10-30
 *      Author: maciek
 */
#ifndef SIGNAL_H_
#define SIGNAL_H_
using namespace std;

#include <complex>
#include <vector>
#include <functional>


class robot;
/* TODO: Paweł */

class signalR {
public:
	signalR();
	signalR(robot &Owner, double Time);
	signalR(robot *Owner,
			double Time,
			const int& RobotPriority,
			const complex<double> &Place,
			const complex<double> &Position,
			const complex<double> &ReservedPosition
			);

	virtual 	~signalR();
	bool 		operator<( const signalR& RightSignal ) const;
	bool 		operator>( const signalR& RightSignal ) const;
	double 		getTime( void ) const;
	signalR& 	returnThis( void );
	robot*		owner( void );
	int			getPriority();
	complex<double> getPlace();

	/*
	 * Updates "send data" values of signal from _ownner.
	 *
	 * It should be done before sending signal to ether.
	 *
	 */
	int update( const complex<double> &Place,
			const complex<double> &Position,
			const complex<double> &ReservedPosition);

protected:
	//int  	_robotID; // == _priority
	robot* 	_owner;
	double 	_time;
	// send data:
	complex<double>  			_place;
	int 						_priority;
	complex< double >				_position;
	complex< double >				_reservedPosition;


};

struct signalRTimeCompare : public binary_function<signalR*, signalR*, bool>{
	bool operator()(const signalR* LeftS, const signalR* RightS) const{
		return *LeftS > *RightS;
	}
};

#endif /* SIGNAL_H_ */
